﻿
<script>
    var tempmodel = avalon.define({
        $id: "LSGL",
        name: "老师管理",

        LSGLTypeData:[],
        modelData: (!pmodel.pageType && localStorage.getItem(pmodel.FormCode)) ? $.parseJSON(localStorage.getItem(pmodel.FormCode)) :{ "LS_LSXM": "", "LS_LSLXFS": "", "LS_Type": "", "LS_ZYKC": "", "LS_Address": "", "LS_LSTP": "", "FileS": "", "LS_LSJS": "", "LS_BeiZhu": "" },
        iswf: false,//是否属于流程表单
        inittemp: function (strId) {
            //获取请假类型
            $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 11 }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempmodel.LSGLTypeData = resultData.Result;
                    if (!tempmodel.modelData.LS_Type) {
                        tempmodel.modelData.LS_Type = resultData.Result[0].TypeNO;
                    }
                }
            })
            if (strId) {
                //编辑加载数据
                $.getJSON('/API/FTAPI.ashx?Action=GETLSGLMODEL', { P1: strId }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;
                        setTimeout(" ComFunJS.initForm()", 500)
                    }
                })
            } else {
                ComFunJS.initForm()
            }
        },//初始化
        SaveData: function (btdom, piid) {
            var data = tempmodel.modelData.$model;
            var modelValue = JSON.stringify(data);
            $.post("/API/FTAPI.ashx?ACTION=ADDLSGL", { P1: modelValue }, function (result) {
                var jsonresult = $.parseJSON(result)
                btdom.removeClass("disabled").find("i").hide();
                if ($.trim(jsonresult.ErrorMsg) == "") {
                    ComFunJS.winsuccessnew("操作成功");
                }
            });
        },
    });
    tempmodel.$watch("modelData.*", function (a, b) {
        if (!tempmodel.modelData.ID) {
            localStorage.setItem(pmodel.FormCode, JSON.stringify(tempmodel.modelData.$model));
        }
    })
</script>
<div class="form-horizontal" ms-controller="LSGL">
    <div class="form-group">
        <label class="col-xs-2 control-label"> <span class="Required">*</span>老师类别 </label>
        <div class="col-xs-3">
            <select ms-duplex="modelData.LS_Type" class="form-control">
                <option ms-repeat-item="LSGLTypeData" ms-attr-value="item.TypeNO">{{item.TypeNO}}</option>
            </select>
        </div> 
        <label class="col-xs-2 control-label"><span class="Required">*</span>老师名称</label>
        <div class="col-xs-3">
            <input type="text" value="" ms-duplex="modelData.LS_LSXM" class="form-control szhl_require" />
        </div>
      
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><span class="Required">*</span>老师联系方式</label>
        <div class="col-xs-3">
            <input type="text" value="" ms-duplex="modelData.LS_LSLXFS" class="form-control szhl_require" />
        </div>
        <label class="col-xs-2 control-label">主要课程</label>
        <div class="col-xs-3">
            <input type="text" value="" ms-duplex="modelData.LS_ZYKC" class="form-control szhl_require" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><span class="Required">*</span>地点</label>
        <div class="col-xs-3">
            <input type="text" value="" ms-duplex="modelData.LS_Address" class="form-control szhl_require" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><span class="Required">*</span>老师图片</label>
        <div class="col-xs-8">
            <input type="text" value="" ms-duplex="modelData.LS_LSTP" class="form-control szhl_Upload szhl_require" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">附件</label>
        <div class="col-xs-8">
            <input type="text" value="" class="span2  szhl_Upload form-control" ms-duplex="modelData.Files" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">老师介绍</label>
        <div class="col-xs-8"> 
            <textarea id="conLSJS" ms-duplex="modelData.LS_LSJS" class="szhl_UEEDIT form-control "></textarea> 
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">备注</label>
        <div class="col-xs-8">
            <textarea id="conRemark" ms-duplex="modelData.LS_BeiZhu" class="szhl_UEEDIT form-control "></textarea>
        </div>
    </div> 
</div>
